package com.pignest.hotel.ui.protocol;

import java.util.List;

import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;

import com.pignest.framework.util.Utils;
import com.pignest.hotel.beans.ProtocolPrice;
import com.pignest.hotel.spring.Services;

public class ProtocolQueryVbox extends ProtocolUnitVbox {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2715360030922126794L;

	@Override
	public void queryProtocolPrice(String protocolId) {
		// TODO Auto-generated method stub
		super.priceListbox.getItems().clear();
		List<ProtocolPrice> list =Services.getOtherBusiService().queryProtocolPrice(protocolId);
		if(list==null)
			return ;
		int i=1;
		for(final ProtocolPrice p:list)
		{
			Listitem listitem = new Listitem();
			listitem.setValue(p.getId());
			listitem.setParent(super.priceListbox);
			listitem.appendChild(new Listcell(String.valueOf(i)));
			listitem.appendChild(new Listcell(p.getRoomType().getName()));
			listitem.appendChild(new Listcell(Utils.toPrice(p.getRoomType().getPrice())));
			listitem.appendChild(new Listcell(Utils.toPrice(p.getPrice())));
			i++;
		}
	}
}
